//
//  NetUtil.h
//  FreeNet
//
//  Created by cc on 12-7-5.
//  Copyright (c) 2012年 cc. All rights reserved.
//

#ifndef _FREENET_NETUTIL_H_CC_
#define _FREENET_NETUTIL_H_CC_

#include "NetDefine.h"

namespace FreeNet {

    extern int lockThing() ;
    extern int unlocThing() ;
}


///////////////////////////////////////////////////////////////////////////
// UTILITY.
#define DECLARE_VARIABLE_READYONLY(varName, getName, varType) \
private: \
varType varName ; \
public: \
const varType get##getName() const { return varName ; }

#define DECLARE_INSTANCE_VARIABLE_WRITEONLY(varName, varType) \
private: \
varType varName ; \
public: \
void set##varName(const varType& value) { ::memcpy(&varName, &value, sizeof(varType)) ; }

#define DECLARE_INSTANCE_VARIABLE(varName, varType) \
private: \
    varType varName ; \
public: \
    const varType   get##varName() const { return varName ; } \
    void            set##varName(const varType& value) { ::memcpy(&varName, &value, sizeof(varType)) ; }

#define DECLARE_BASIC_VARIABLE(varName, varType) \
private: \
varType varName ; \
public: \
const varType   get##varName() const { return varName ; } \
void            set##varName(const varType value) { varName = value ; }
///////////////////////////////////////////////////////////////////////////

#endif
























